package com.ssx.rule;

import com.netflix.loadbalancer.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Package com.ssx.rule
 * @ClassName MyselfRule
 * @Copyright: Copyright (c) 2020
 * @Date 2020/11/20 18:10
 * @Company www.sudaoxi.com.cn
 * @Author 苏道羲
 * @Version 1.0
 * @Description
 */
//使用自己的Ribbon替换规则，不能在@ComponentScan注解的类所在包及子包下，也就是不能在springboot主启动类所在包下
@Configuration
public class MyselfRule {
    @Bean
    public IRule myRule(){
//      RoundRobinRule, RandomRule, RetryRule, WeightedResponseTimeRule, BestAvailableRule, AvailabilityFilteringRule, ZoneAvoidanceRule
        return new RandomRule();//定义为随机
    }
}
